<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // let arr = [1,2,3,4,5];

        // console.log(arr);

        let obj = {
            name:"老王",
            age:18,
            sex:"男"
        }

        console.log(obj);

        // 可迭代对象
        Object.prototype[Symbol.iterator] = function(){
            let arr = Object.keys(obj);
            let index =0;
            return {
                next:function(){
                    return {
                        value:arr[index],
                        done:arr.length==index++
                    }
                }
            }
        }

        for(let item of obj){
            console.log(item);
        }

    </script>
</body>
</html>